package cn.tedu.review;

/*
Author     :Dsi
Date       : 2021/11/23 9:36
Description: 该类用于复习设计模式之懒汉式
*/
public class Singleton02 {
    public static void main(String[] args) {
        Single02 s=Single02.get();
        Single02 s1=Single02.get();
        Single02 s2=Single02.get();
        Single02 s3=Single02.get();
        System.out.println(s1);
        System.out.println(s2);
        System.out.println(s3);
    }
}
class Single02{
    private static Single02 s;
    private Single02(){}
    public static Single02 get (){
        if (s==null){
            s=new Single02();
        }
        return s;
    }
}